package com.buka.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.buka.APi.PayApi;
import com.buka.dao.OrderDao;
import com.buka.entity.Order;
import com.buka.entity.Pay;
import com.buka.service.OrderService;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;

/**
 * (Order)表服务实现类
 *
 * @author makejava
 * @since 2025-07-15 16:07:30
 */
@Service("orderService")
public class OrderServiceImpl extends ServiceImpl<OrderDao, Order> implements OrderService {

    @Resource
    PayApi payApi;

    @Override
    @GlobalTransactional
    public boolean save(Order entity) {

        Pay pay = new Pay();
        pay.setManey(new BigDecimal(100));
        pay.setCreateat(new Date());
        payApi.insert(pay);

        return super.save(entity);

    }
}

